void markQueen(int x, int y, int value)
	for (int i=0i < ArSize; i++}
		for (int j=0; j < ArSize; j++)
			if(i == x | | j == y | | (i-x) == (j-y) | | (x-i) == (j-y))
				arr[i][j] += value; 		
void outPut(int x, int y, int tot){
	if(printTimes <= printTime) return
	printTime + +;
    cout << "********************** x=" << x << " y=" << y << " tot=" << tot << " num=" << num << " time=" << printTime << "*********************" << endl;
    for (int i=0; i < ArSize; ++i){
        for (int j=0; j < ArSize; ++j){
            cout << arr[i][j] << " "; }
        cout << endl; }
    cout << "*********************************************" << endl; }
void solve(int x, int y, int tot)
	if (tot ==ArSize) 
		num++
		return; 	 
    for (int i = 0; i < ArSize; ++i)
		if(i <x) continue;
            for (int j = 0; j < ArSize; ++j){
        	if(i ==x && j<y) continue;
            if(!arr[i][j]){
		        markQueen(i, j,1);
          		        solve(i, j, tot + 1);
		        markQueen(i, j,-1);     
			}
                    }
    }
}
	cin>>ArSize 
	memset(arr, 0,sizeof(arr));
    solve(0, 0,0);
	cout<<num<<endl;
    return 0; 